<%@ page contentType="text/html" pageEncoding="UTF-8" language="java"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<div id="edit-bet">
  <div class="box">
    <h2>Editer un pari</h2>
    <div id="bet" class="box-content">
      <form action="" method="post">
        <fieldset>
          <p>
            <label>Nom :</label>
            <input type="hidden" name="id" value="${bet.id}"/>
            <input type="text" name="name" value="${betname}"/>
            <input type="checkbox" <c:choose><c:when test="${bet.status}"> checked="checked" </c:when> </c:choose> name="status" value="${bet.status}" />
            <label>Activé</label>
          </p>
          <p>
            <label>Description :</label>
            <textarea name="description" rows="6" cols="48"><c:out value="${bet.description}"/></textarea>
          </p>
          <p>
            <label>Catégorie :</label>
            <select name="subsection">
              <c:forEach items="${categories}" var="cat">
                <option  <c:choose><c:when test="${cat.id==bet.subsection}"> selected="selected" </c:when> </c:choose> value="${cat.id}"><c:out value="${cat.name}"/></option>
              </c:forEach>
            </select>
          </p>
          <p>
            <label>Date de début :</label>
            <input type="datetime" name="startTime" value="${start}"/>
          </p>
          <p>
            <label>Date de fin :</label>
            <input type="datetime" name="endTime" value="${end}"/>
          </p>
          <c:choose>
            <c:when test="${canAdd}">
              <div id="submit-bet-save" class="submit-button">
                <div class="top"></div>
                <div class="content">Sauvegarder</div>
              </div>
            </c:when>
          </c:choose>
        </fieldset>
      </form>
    </div>
  </div>
  <div class="box">
    <h2>Choix</h2>
    <div class="box-content">
      <form method="post" action="#">
        <fieldset>
          <ul id="choices-available">
            <c:forEach items="${choices}" var="c">
              <li <c:choose><c:when test="${c.isWinning}">class="win"</c:when></c:choose>>
                <c:choose><c:when test="${canValid}"><input type="radio" name="winner" value="${c.id}"/></c:when></c:choose>
                <label><c:out value="${c.label}"/></label>
                <c:choose><c:when test="${canAdd}"><a href="#supprimer">Supprimer</a></c:when></c:choose>
                <c:choose><c:when test="${c.isWinning}"><span class="win">Gagné !</span></c:when></c:choose>
              </li>
            </c:forEach>
          </ul>
          <c:choose><c:when test="${canAdd}"><input type="text" name="choiceName" value="" size="60" /></c:when></c:choose>
          <c:choose>
            <c:when test="${canAdd}">
              <div id="submit-betchoice-edit" class="submit-button">
                <div class="top"></div>
                <div class="content">Ajouter</div>
              </div>
            </c:when>
          </c:choose>
          <c:choose>
            <c:when test="${canValid}">
              <div id="terminate-bet" class="submit-button">
                <div class="top"></div>
                <div class="content">Clôturer le pari</div>
              </div>
            </c:when>
          </c:choose>
        </fieldset>
      </form>
    </div>
  </div>
</div>